// Project name:JavaRedis
// Creator:muhong
// Date time:2022/12/22,11:13 下午
// Name:ObjectUtil

package org.gmh.util.internal;

public final class ObjectUtil {

    private static final int INT_ZERO = 0;

    private ObjectUtil(){

    }

    public static <T> T checkNotNull(T arg, String text){
        if (arg == null){
            throw new NullPointerException(text);
        }
        return arg;
    }

    public static int checkPositiveOrZero(int i, String name){
        if (i < INT_ZERO){
            throw new IllegalArgumentException(name + " : " + i + " (expected: >= 0)");
        }

        return i;
    }
}
